<?php
/**
 * Created by PhpStorm.
 * User: ZhangYi
 * Date: 2010-12-24
 * Time: 13:33:58
 * To change this template use File | Settings | File Templates.
 */

class BackendVideoGroupForm extends BaseVideoGroupForm {
    public function setup() {
        $this->setWidgets(array(
            'video_group_id' => new sfWidgetFormInputHidden(),
            'title' => new sfWidgetFormTextarea(),
            'artist' => new sfWidgetFormInputText(),
            'publish_time' => new sfWidgetFormDateTime(),
            'create_time' => new sfWidgetFormDateTime(),
            'modify_time' => new sfWidgetFormDateTime(),
            'catalog_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'add_empty' => true)),
            'sub_catalog_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog_2'), 'add_empty' => true)),
            'tag' => new sfWidgetFormTextarea(),
            'keyword' => new sfWidgetFormTextarea(),
            'brief' => new sfWidgetFormTextarea(),
            'source' => new sfWidgetFormTextarea(),
            'status_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'add_empty' => true)),
            'member_level_i' => new sfWidgetFormInputText(),
            'snapshot' => new sfWidgetFormTextarea(),
            'is_audit_b' => new sfWidgetFormInputCheckbox(),
            'brief_title' => new sfWidgetFormTextarea(),
            'video' => new sfWidgetFormDoctrineChoice(
                array(
                    'multiple' => true,
                    'expanded' => true,
                    'model' => $this->getRelatedModelName('Video'),
                    'add_empty' => true)
            ),

//            'system_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SystemUser'), 'add_empty' => true)),
        ));

        $this->setValidators(array(
            'video_group_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('video_group_id')), 'empty_value' => $this->getObject()->get('video_group_id'), 'required' => false)),
            'title' => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
            'artist' => new sfValidatorString(array('max_length' => 100, 'required' => false)),
            'publish_time' => new sfValidatorDateTime(array('required' => false)),
            'create_time' => new sfValidatorDateTime(array('required' => false)),
            'modify_time' => new sfValidatorDateTime(array('required' => false)),
            'catalog_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'required' => false)),
            'sub_catalog_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog_2'), 'required' => false)),
            'tag' => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
            'keyword' => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
            'brief' => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
            'source' => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
            'status_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'required' => false)),
            'member_level_i' => new sfValidatorInteger(array('required' => false)),
            'snapshot' => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
            'is_audit_b' => new sfValidatorBoolean(array('required' => false)),
            'brief_title' => new sfValidatorString(array('max_length' => 2147483646, 'required' => false)),
            'system_user_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SystemUser'), 'required' => false)),
        ));

        $this->widgetSchema->setNameFormat('video_group[%s]');

        $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

        $this->setupInheritance();

        parent::setup();
    }
}
